# $Id$
# Contributor: Jevgeny Krasovsky <jkrasovsky@gmail.com>

_realname=qrencode
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.1.0
pkgrel=1
pkgdesc="C library for encoding data in a QR Code symbol (mingw-w64)"
arch=(any)
depends=("${MINGW_PACKAGE_PREFIX}-libpng")
makedepends=(${MINGW_PACKAGE_PREFIX}-SDL)
url="https://fukuchi.org/works/qrencode/index.en.html"
license=('GPL')
source=(https://fukuchi.org/works/${_realname}/${_realname}-${pkgver}.tar.bz2)
sha256sums=('ac7eff020d94be016d5b93bc6567f10a4a4692dcced901a384300f589a6cad0a')

build() {
  rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --with-tests

  make
}

check () {
  make check -C build-${MINGW_CHOST}
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  install -Dm0644 ${srcdir}/${_realname}-${pkgver}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
